package com.chaber.containers.services;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.chaber.containers.beans.ProductData;
import com.chaber.containers.beans.searchcriteria.ProductSearchCriteria;
import com.chaber.containers.daos.ProductDAO;

public class ProductService extends AbstractService {

	@Autowired
	private ProductDAO productDAO;
	
	public ProductData getProduct(String barCode) {
		ProductData result = this.productDAO.findOne(barCode);
		return result;
	}
	
	public void save(ProductData productData) {
		this.productDAO.save(productData);
	}

	public void remove(String barCode) {
		this.productDAO.delete(barCode);
	}
	
	public List<ProductData> findAll(ProductSearchCriteria searchCriteria) {
		List<ProductData> result = this.productDAO.findAll(searchCriteria);
		return result;
	}
}
